function callClientFunction(funcname, ...)
    local arg = { ... }
    if (arg[1]) then
        for key, value in next, arg do arg[key] = tonumber(value) or value end
    end
    loadstring("return "..funcname)()(unpack(arg))
end
addEvent("onServerCallsClientFunction", true)
addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction)

function outputTimeChat(player,message,theType,team)
 if(theType==0)then
  outputChatBox(getTimeStamp() .. " #" .. getHexColor(player,"joined") .. getPlayerName(player) .. ": #ffffff" .. message,255,255,255,true)
 elseif(theType==1)then
  outputChatBox(getTimeStamp() .. " #bb00bb" .. getPlayerName(player) .. " " .. message,255,255,255,true)
 elseif(theType==2)then
  outputChatBox(getTimeStamp() .. " #" .. getHexColor(team,"joined") .. "(" .. getTeamName(team) .. ") " .. getPlayerName(player) .. ": " .. message,255,255,255,true)
 end
end

function getTimeStamp(argument)
 local theTime=getRealTime()
 local hours=theTime.hour
 local minutes=theTime.minute
 if(string.len(hours)<2)then
  hours=0 .. hours
 end
 if(string.len(minutes)<2)then
  minutes=0 .. minutes
 end
 local timeStamp=("[" .. hours .. ":" .. minutes)
 if(argument=="seconds")then
  local seconds=theTime.second
  if(string.len(seconds)<2)then
  seconds=0 .. seconds
  end
  timeStamp=(timeStamp .. ":" .. seconds)
 end
 local timeStamp=timeStamp .. "]"
 return(timeStamp)
end

function getHexColor(element,argument)
 local r=0
 local g=0
 local b=0
 local hexTab={}
 if(element)then
  if(getElementType(element)=="player")then
   r,g,b=getPlayerNametagColor(element)
  elseif(getElementType(element)=="team")then
   r,g,b=getTeamColor(element)
  end
   hexTab.r=r
   hexTab.g=g
   hexTab.b=b
   for k,v in pairs(hexTab)do
    local hex=string.format("%X",v)
	if(string.len(hex)<2)then
	 hex=0 .. hex
	end
    hexTab[k]=hex
   end
  if not(argument)then
   return hexTab.r,hexTab.g,hexTab.b
  else
   return hexTab.r .. hexTab.g .. hexTab.b
  end
 else
  return false
 end
end
